#include <iostream>
#include <unistd.h>
#include <sys/signal.h>

using std::cout;
using std::endl;

void sig_handle(int sig_num)
{
    printf("before signal, sig num is %d\n", sig_num);
    sleep(3);
    printf("after signal, sig num is %d\n", sig_num);
}

int main(int args, char *argv[])
{
    signal(SIGINT, &sig_handle);
    signal(SIGQUIT, &sig_handle);
    while(1);
    return 0;
}